package com.demo.wrapper.utils;

import com.demo.wrapper.enums.OrderEnum;
import org.elasticsearch.search.sort.SortOrder;

import java.util.Objects;

/**
 * @author 19242
 */
public class FieldValueUtil {
    /**
     * 获取排序
     *
     * @param orderEnum
     * @return
     */
    public static SortOrder sortOrder(OrderEnum orderEnum) {
        if (Objects.isNull(orderEnum)) {
            return SortOrder.ASC;
        }
        return orderEnum == OrderEnum.ASC ? SortOrder.ASC : SortOrder.DESC;
    }
}
